package com.free.mini.core.serve.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.free.mini.common.base.ResultData;
import com.free.mini.core.server.api.BannerConfigApi;
import com.free.mini.core.server.vo.req.BannerConfigCreateReqVO;
import com.free.mini.core.server.vo.req.BannerConfigDelReqVO;
import com.free.mini.core.server.vo.req.BannerConfigQueryReqVO;
import com.free.mini.core.server.vo.req.BannerConfigUpdateReqVO;
import com.free.mini.core.server.vo.resp.BannerConfigQueryRespVO;
import org.springframework.web.bind.annotation.RestController;

import com.free.mini.core.serve.service.IBannerConfigService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * banner Controller
 *
 * @author dongsufeng
 * @date 2023-08-22 15:17:42
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class BannerConfigController implements BannerConfigApi {

    private final IBannerConfigService bannerConfigService;


    @Override
    public ResultData<Page<BannerConfigQueryRespVO>> bannerConfigList(BannerConfigQueryReqVO reqVO) {
        return ResultData.data(bannerConfigService.findBannerConfigs(reqVO));
    }

    @Override
    public ResultData<Boolean> addBannerConfig(BannerConfigCreateReqVO reqVO) {
        return ResultData.data(bannerConfigService.createBannerConfig(reqVO));
    }

    @Override
    public ResultData deleteBannerConfig(BannerConfigDelReqVO reqVO) {
        return ResultData.data(bannerConfigService.delete(reqVO.getIds()));
    }

    @Override
    public ResultData updateBannerConfig(BannerConfigUpdateReqVO reqVO) {
        return ResultData.data(bannerConfigService.updateBannerConfig(reqVO));
    }
}
